{{include template('public/header','admin')}}
<body>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <div class="search">
                    <div class="well">
                        <form class="form-inline" action="{{url()}}" method="get"  id="search">
                            {{$html}}
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <form method="post" action="/district/district/index" class="form-inline" role="form">
                    <input type='hidden' name='formhash' value="{{FORMHASH}}" />
                    <table id='District_list' class="table table-condensed table-hover table-striped tablesorter table-fixed table-selectable">
                        <thead>
                            <tr>
                                <th>{{L('district_displayorder')}}</th>
                                <th>{{L('district_name')}}</th>
                                {{if !$values[0]}}
                                <th>出生地</th>
                                <th>居住地</th>
                                {{/if}}
                                <th>{{L('edit')}}</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{foreach $items as $item}}
                            <tr  id="td_{{$item[0]}}" >
                                <td><input type="text" class="form-control"  id="displayorder_{{$item[0]}}" name="displayorder[{{$item[0]}}]" value="{{$item[2]}}"   datatype="*" nullmsg="请输入{{L('district_displayorder')}}！" errormsg="{{L('district_displayorder')}}错误,请重新输入！" placeholder="请输入{{L('district_displayorder')}}" /></td>
                                <td><p id="p_{{$item[0]}}"><input type="text" class="form-control" id="input_{{$item[0]}}" name="district[{{$item[0]}}]" value="{{$item[1]}}"   datatype="*" nullmsg="请输入{{L('district_name')}}！" errormsg="{{L('district_name')}}错误,请重新输入！" placeholder="请输入{{L('district_name')}}" /></p></td>
                                {{if !$values[0]}}
                                <td><input type="checkbox" name="birthcity[{{$item[0]}}]" value="1" class="checkbox" {{if $item[3] && in_array($item[3], array(1,3))}} checked="checked" {{/if}}  /></td>
                                <td><input type="checkbox" name="residecity[{{$item[0]}}]" value="1" class="checkbox"{{if $item[3] && in_array($item[3], array(2,3))}} checked="checked" {{/if}}   /></td>
                                {{/if}}
                                <td><a href="javascript:;" onclick="deletedistrict({{$item[0]}}); return false;">{{L('delete')}}</a></td>
                            </tr>
                            {{/foreach}}
                        </tbody>

                        <tr>
                            <td style="width: 15px;"></td>
                            <td colspan="4">
                                <div><a href="javascript:;" onclick="addrow(this, 0)" class="addtr">{{L('add')}} {{L('district')}}</a></div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="15">
                                <div style="text-align: left;">
                                    <input type="submit" class="btn" name="editsubmit" value="{{L('submit')}}" />
                                    {{include template('public/page','admin')}}
                                </div>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
    <script>
        var rowtypedata = [
        [
        [0, '<input type="text" class="form-control" name="districtnew_order[]" value="0" datatype="*" nullmsg="请输入{{L('district_displayorder')}}！" errormsg="{{L('district_displayorder')}}错误,请重新输入！" placeholder="请输入{{L('district_displayorder')}}" />'],
        [0, '<input type="text" class="form-control" name="districtnew[]"   datatype="*" nullmsg="请输入{{L('district_name')}}！" errormsg="{{L('district_name')}}错误,请重新输入！" placeholder="请输入{{L('district_name')}}" />']
        ]
        ];
    </script>
    <script type="text/javascript">
        _attachEvent(document.documentElement, 'keydown', function(e) {
        entersubmit(e, 'editsubmit');
        });
        function refreshdistrict(province, city, district) {
        location.href = "/district/district/index?action=district"
                + "&province=" + province + "&city=" + city + "&district=" + district
                + "&pid=" + document.getElementById(province).value + "&cid=" + document.getElementById(city).value + "&did=" + document.getElementById(district).value;
        }
        function editdistrict(did) {
        document.getElementById('input_' + did).style.display = "block";
        document.getElementById('span_' + did).style.display = "none";
        }
        function deletedistrict(did) {
        var elem = document.getElementById('p_' + did);
        elem.parentNode.removeChild(elem);
        var elem = document.getElementById('td_' + did);
        elem.parentNode.removeChild(elem);
        }
    </script>
</body>
</html>